# -*- coding: utf-8 -*-
from wython import fn, jinja2

class Main:
	def setup(self, settings):
		self.settings = settings
		self.count = 0
		pass

	def execute(self, gate):
#		gate.dump(gate.env)
		self.count += 1
		tpl = jinja2.Template(u'Hello from {{ controller }}!<br />Here\'s our environment:<br /><pre>{{ env }}</pre><br />Your request is No {{ count }}.')
		gate.writen(tpl.render(controller='IndexController', env = gate.env, count = self.count))
#		gate.writen('Hello from IndexController!')
#		gate.writen('Here`s our environment:')
#		gate.writen('<pre>%s</pre>' % gate.env)
#		gate.writen(fn.htmlspecialchars('<b>asd</b>'))
#		raise Exception('Wtf?')
#		gate.writen('Bye!')
		return True

